package pt.isec.a21210392.a21190220.ludotwist.GameLogic;

import pt.isec.a21210392.a21190220.ludotwist.GameActivity;
import pt.isec.a21210392.a21190220.ludotwist.R;
import pt.isec.a21210392.a21190220.ludotwist.ToDraw;

public class SuperPin extends Pin
{
	private static final long serialVersionUID = 1L;
	private static final int[] superPinImages = {R.drawable.blue_super_pin,R.drawable.yellow_super_pin,R.drawable.green_super_pin,R.drawable.red_super_pin};
	private int superPinImage;
	
	public SuperPin(Player player, int actualHouse) 
	{
		super(player);
		this.superPinImage = superPinImages[player.getNumber()];
		this.setHouse(actualHouse);
		this.atTheBegin = false;
	}
	
	public void separatePins()
	{
		Pin pin;
		
		player.removePin(this);
		GameActivity.boardView.removePinToDraw(new ToDraw(this));
		
		pin = new Pin(player);
		player.addPin(pin);
		pin.putIn();
		
		pin = new Pin(player);
		player.addPin(pin);
		pin.putIn();
	}
	
	@Override
	public int getImage() 
	{
		return superPinImage;
	}
	@Override
	public boolean equals(Object o) 
	{
		if (o instanceof SuperPin)
		{
			return this.color.equals(((SuperPin)o).getColor()) && this.pinNumber == ((SuperPin)o).getPinNumber();
		}
		return false;
	}
}
